/*! ******************************************************************************
 *
 * Created on 2022-08-01
 *
 * Copyright(c) YuZhou Big Data Laboratory CO.,Ltd, 2022.  All rights reserved.
 *
 *******************************************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ******************************************************************************/
package org.yzbdl.lanius.core.database.dialog;

import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;

/**
 * 继承重写汉化进度条窗体
 *
 * @author yzbdl@yzbdl.ac.cn
 * @version 1.0
 * @date 2021/7/5 9:18
 */
public class DatabaseInfoProgressDialog extends ProgressMonitorDialog {
    private Cursor waitCursor;

    public DatabaseInfoProgressDialog(Shell parent) {
        super(parent);
    }

    /**
     * 此方法重写汉化
     * @param shell 显示器
     */
    protected void configureShell(final Shell shell) {
        super.configureShell(shell);
        shell.setText("进度显示条");
        if (this.waitCursor == null) {
            this.waitCursor = new Cursor(shell.getDisplay(), 1);
        }
        shell.setCursor(this.waitCursor);
    }

    /**
     * 取消按钮重写汉化
     * @param parent 显示器
     */
    protected void createCancelButton(Composite parent) {
        this.cancel = this.createButton(parent, 1, "取消", true);
        if (this.arrowCursor == null) {
            this.arrowCursor = new Cursor(this.cancel.getDisplay(), 0);
        }

        this.cancel.setCursor(this.arrowCursor);
        this.setOperationCancelButtonEnabled(this.enableCancelButton);
    }
}
